package com.blen.videolib;


import android.os.Environment;

import com.blen.videolib.util.FFUtils;

import java.io.File;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * Created by zhaoshuang on 17/2/8.
 */

public class VideoSDK {

    public static int VIDEO_MAX_LENGTH = 15000;
    public static int VIDEO_MIN_LENGTH = 2000;

    public static boolean isDebug = true;
    public static boolean isShowTime = isDebug;

    public static String VIDEO_CACHE;
    public static String VIDEO_ALBUM ;
    public static ThreadPoolExecutor mExecutor;


    //返回带"/"结尾的
    public static StringBuilder getVideoCache(){
        return new StringBuilder(VIDEO_CACHE==null? Environment.getDownloadCacheDirectory().getAbsolutePath() :VIDEO_CACHE).append("/");
    }

    public static StringBuilder getVideoAlbum(){
        return new StringBuilder(VIDEO_ALBUM == null?"":VIDEO_ALBUM).append("/");
    }

    public static boolean initSDK(String cachePath,String albumPath,boolean debug, ThreadPoolExecutor executor){
        mExecutor = executor;
        isDebug = debug;
        isShowTime = debug;
        return initSDK(cachePath,albumPath);
    }

    private static boolean initSDK(String cachePath,String albumPath) {
        if(cachePath==null)
            cachePath = "/Jade";
        VIDEO_CACHE = cachePath+ "/video";
        if(albumPath == null)
            albumPath = "/Jade";
        VIDEO_ALBUM = albumPath;

        File cache = new File(VIDEO_CACHE);
        if (!cache.exists()) cache.mkdirs();
        File album = new File(VIDEO_ALBUM);
        if (!album.exists()) album.mkdirs();

        // 初始化拍摄SDK，必须
//        JianXiCamera.init(getVideoCache().toString(),isDebug);
        return FFUtils.init(cachePath,isDebug);
    }

    public static void release(){

    }

}
